home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 61 / Quick PC 61.iso / I386 / SASETUP.MSI / F77716_site_modify.asp < prev    next >
Encoding:
Text File  |  2003-02-21  |  23.9 KB  |  801 lines

  1. <%@ Language=VBScript   %>
  2. <%    Option Explicit     %>
  3. <%
  4.     '    Response.Buffer = True
  5.     '-------------------------------------------------------------------------
  6.     '    site_modify.asp: Serves in creating a new site
  7.     '
  8.     ' Copyright (c) Microsoft Corporation.  All rights reserved. 
  9.     '
  10.     '    Date            Description
  11.     '    14-Jan-2001        Creation Date
  12.     '    25-Jan-2001        Last Modified Date
  13.     '-------------------------------------------------------------------------
  14. %>
  15.  
  16.     <!-- #include virtual="/admin/inc_framework.asp" -->    
  17.     <!-- #include file="resources.asp" -->
  18.     <!-- #include file="inc_wsa.asp" -->    
  19.     <!-- #include file="Sitemodify_prop.asp" -->
  20. <%
  21.  
  22.     Err.Clear
  23.     'On Error Resume Next
  24.     '-------------------------------------------------------------------------
  25.     ' Global Constants and Variables
  26.     '-------------------------------------------------------------------------
  27.     Dim G_strDirRoot        'to hold Domainname value    
  28.     Dim G_strSysName        'to hold system name    
  29.     Dim G_strSiteNum        'to hold site name        
  30.     Dim G_AnonUserName        'to hold anonymouse username created by IIS
  31.  
  32.     Dim rc                    'to hold return count value
  33.     Dim page                'to hold page object
  34.  
  35.     Dim idTabGeneral        'to hold Ist tab value
  36.     Dim idTabSiteID            'to hold IInd tab value
  37.     Dim idTabAppSetting        'to hold Vth tab value
  38.  
  39.     '=========================================================================
  40.     ' Entry point
  41.     '=========================================================================
  42.     
  43.     ' Set username value
  44.     G_AnonUserName = GetIISAnonUsername()
  45.     
  46.     ' Create a Tabbed Property Page
  47.     rc = SA_CreatePage( L_TASKTITLE_TEXT, "", PT_TABBED, page )
  48.     
  49.     
  50.     ' Add five tabs
  51.     rc = SA_AddTabPage( page, L_GENERAL_TEXT, idTabGeneral)
  52.     rc = SA_AddTabPage( page, L_SITEIDENTITY_TEXT, idTabSiteID)
  53.     rc = SA_AddTabPage( page, L_APPLICATIONSETTINGS_TEXT, idTabAppSetting)
  54.     
  55.     ' Show the page
  56.     rc = SA_ShowPage( page )
  57.     
  58.     
  59.  
  60.     '=========================================================================
  61.     ' Web Framework Event Handlers
  62.     '=========================================================================
  63.     
  64.     '-------------------------------------------------------------------------
  65.     ' Function:    OnInitPage
  66.     '
  67.     ' Synopsis:    Called to signal first time processing for this page. Use 
  68.     '            this method to do first time initialization tasks. 
  69.     '
  70.     ' Returns:    TRUE to indicate initialization was successful. FALSE to 
  71.     '            indicate errors. Returning FALSE will cause the page to be 
  72.     '            abandoned.
  73.     '
  74.     '-------------------------------------------------------------------------
  75.     Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  76.         Err.clear
  77.         on Error Resume Next
  78.     
  79.         G_strSiteNum = Request.QueryString("PKey")
  80.  
  81.         SetFormVarsFromSystem()
  82.  
  83.         OnInitPage = TRUE
  84.     End Function
  85.  
  86.     '-------------------------------------------------------------------------
  87.     ' Function:    OnPostBackPage
  88.     '
  89.     ' Synopsis:    Called to signal that the page has been posted-back. A post-
  90.     '            back occurs in tabbed property pages and wizards as the user 
  91.     '            navigates through pages. It is differentiated from a Submit
  92.     '            or Close operationin that the user is still working with the 
  93.     '            page.
  94.     '
  95.     '            The PostBack event should be used to save the state of page.
  96.     '
  97.     ' Returns:    TRUE to indicate initialization was successful. FALSE to 
  98.     '            indicate errors. Returning FALSE will cause the page to be 
  99.     '            abandoned.
  100.     '-------------------------------------------------------------------------
  101.     Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)        
  102.         Err.clear
  103.         on Error Resume Next
  104.     
  105.         'get variables from form
  106.         call SetGenFormVariables()
  107.         
  108.         call SetSiteIdentitiesFormVariables()
  109.         
  110.         call SetApplnSettingsFormVariables()
  111.  
  112.         Call SA_TRACEOUT("OnPostBackPage","OnPostBackPage called")
  113.  
  114.         OnPostBackPage = TRUE
  115.  
  116.     End Function
  117.  
  118.  
  119.     '--------------------------------------------------------------------------
  120.     ' Function:    OnServeTabbedPropertyPage
  121.     '
  122.     ' Synopsis:    Called when the page needs to be served. Use this method to
  123.     '            serve content.
  124.     '
  125.     ' Returns:    TRUE to indicate not problems occured. FALSE to indicate errors.
  126.     '            Returning FALSE will cause the page to be abandoned.
  127.     '
  128.     '--------------------------------------------------------------------------
  129.     Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  130.                                             ByVal iTab, _
  131.                                             ByVal bIsVisible, _
  132.                                             ByRef EventArg)
  133.         ' Emit Web Framework required functions
  134.         If ( iTab = idTabGeneral) Then
  135.             Call ServeCommonJavaScript()
  136.         End If        
  137.  
  138.         ' Emit content for the requested tab
  139.         Select Case iTab            
  140.             Case idTabGeneral
  141.                 Call ServeTabGeneral(PageIn, bIsVisible)
  142.             Case idTabSiteID
  143.                 Call ServeTabSiteID(PageIn, bIsVisible)
  144.             Case idTabAppSetting
  145.                 Call ServeTabAppSetting(PageIn, bIsVisible)
  146.             Case Else
  147.                 SA_TraceOut "TEMPLAGE_TABBED", _
  148.                     "OnServeTabbedPropertyPage unrecognized tab id: " + _
  149.                     CStr(iTab)
  150.         End Select
  151.             
  152.         OnServeTabbedPropertyPage = TRUE
  153.     End Function
  154.  
  155.  
  156.     '-------------------------------------------------------------------------
  157.     ' Function:    OnSubmitPage
  158.     '
  159.     ' Synopsis:    Called when the page has been submitted for processing. Use
  160.     '            this method to process the submit request.
  161.     '
  162.     ' Returns:    TRUE if the submit was successful, FALSE to indicate error(s).
  163.     '            Returning FALSE will cause the page to be served again using
  164.     '            a call to OnServePropertyPage.
  165.     '
  166.     '-------------------------------------------------------------------------
  167.     Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)                
  168.         OnSubmitPage = ModifySite()
  169.     End Function
  170.  
  171.     '-------------------------------------------------------------------------
  172.     ' Function:    OnClosePage
  173.     '
  174.     ' Synopsis:    Called when the page is about to be closed. Use this method
  175.     '            to perform clean-up processing.
  176.     '
  177.     ' Returns:    TRUE to allow close, FALSE to prevent close. Returning FALSE
  178.     '            will result in a call to OnServePropertyPage.
  179.     '
  180.     '-------------------------------------------------------------------------
  181.     Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  182.         OnClosePage = TRUE
  183.     End Function
  184.  
  185.  
  186.     '=========================================================================
  187.     ' Private Functions
  188.     '=========================================================================
  189.         
  190.     '-------------------------------------------------------------------------
  191.     'Function name        :ServeTabGeneral
  192.     'Description        :Serves General tab
  193.     'Input Variables    :PageIn, bIsVisible
  194.     'Output Variables    :None
  195.     'Returns            :Success(Return value)
  196.     'Global Variables    :None    
  197.     '-------------------------------------------------------------------------
  198.     Function ServeTabGeneral(ByRef PageIn, ByVal bIsVisible)        
  199.         
  200.         If ( bIsVisible ) Then
  201.  
  202.             call GeneralViewTab()
  203.       
  204.         Else
  205.             'update hidden variables
  206.             call GeneralHiddenTab()
  207.         
  208.          End If
  209.     
  210.         ServeTabGeneral = gc_ERR_SUCCESS
  211.     
  212.     End Function
  213.  
  214.  
  215.     '-------------------------------------------------------------------------
  216.     'Function name        :ServeTabSiteID
  217.     'Description        :Serves the Site identities tab
  218.     'Input Variables    :PageIn, bIsVisible
  219.     'Output Variables    :None
  220.     'Returns            :Success(Return value)
  221.     'Global Variables    :None    
  222.     '-------------------------------------------------------------------------
  223.     Function ServeTabSiteID(ByRef PageIn, ByVal bIsVisible)    
  224.     
  225.         If ( bIsVisible ) Then
  226.  
  227.             call SiteIdentitiesViewTab()
  228.             
  229.         Else
  230.             'update hidden variables 
  231.     
  232.             call SiteIdentitiesHiddenTab()
  233.         
  234.          End If
  235.     
  236.         ServeTabSiteID = gc_ERR_SUCCESS
  237.     
  238.     End Function
  239.     
  240.     '-------------------------------------------------------------------------
  241.     'Function name        :ServeTabAppSetting
  242.     'Description        :Serve the Application Settings tab
  243.     'Input Variables    :PageIn, bIsVisible
  244.     'Output Variables    :None
  245.     'Returns            :Success(Return value)
  246.     'Global Variables    :None    
  247.     '-------------------------------------------------------------------------
  248.     Function ServeTabAppSetting(ByRef PageIn, ByVal bIsVisible)    
  249.         
  250.             
  251.         If ( bIsVisible ) Then
  252.  
  253.             call ApplicationSettingsViewTab()
  254.             
  255.         Else 
  256.             'update hidden variables
  257.  
  258.             call ApplicationSettingsHiddenTab()
  259.         
  260.         end if
  261.                 
  262.         ServeTabAppSetting = gc_ERR_SUCCESS
  263.     
  264.     End Function
  265.  
  266.     '-------------------------------------------------------------------------
  267.     ' Function:    ServeCommonJavaScript
  268.     '
  269.     ' Synopsis:    Common javascript functions that are required by the Web
  270.     '            Framework.
  271.     '
  272.     '------------------------------------------------------------------------
  273.     Function ServeCommonJavaScript()
  274.     
  275.         Err.clear
  276.         on Error Resume Next
  277.     
  278.     %>
  279.         <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  280.         </script>
  281.  
  282.         <script language="JavaScript">
  283.         //
  284.         // Microsoft Server Appliance Web Framework Support Functions
  285.         // Copyright (c) Microsoft Corporation.  All rights reserved. 
  286.         //
  287.         // Init Function
  288.         // -----------
  289.         // This function is called by the Property Page web framework to  
  290.         // allow the page to perform first time initialization. 
  291.         //
  292.         // This function must be included or a javascript runtime error will
  293.         // occur.
  294.     
  295.         function Init()
  296.             {                
  297.                 //Get the selected tab
  298.                 var temp = top.main.document.forms['frmTask'].TabSelected.value;
  299.                 
  300.                 switch(temp)
  301.                 {
  302.                     //for General prop
  303.                     case '0':
  304.                         GenInit();
  305.                         break;
  306.                     //for Site prop    
  307.                     case '1':
  308.                         SiteInit();                            
  309.                         break;
  310.                     //for Appl prop
  311.                     case '2':
  312.                         ApplInit();
  313.                         break;    
  314.                 }            
  315.             }
  316.    
  317.         
  318.         
  319.         // ValidatePage Function
  320.         // ------------------
  321.         // This function is called by the Property Page framework as part of 
  322.         // the submit processing. Use this function to validate user input. 
  323.         // Returning false will cause the submit to abort. 
  324.         //
  325.         // This function must be included or a javascript runtime error will 
  326.         // occur.
  327.         // Returns: True if the page is OK, false if error(s) exist. 
  328.         
  329.         function ValidatePage()
  330.         {
  331.             
  332.             //Get the selected tab
  333.             var temp = top.main.document.forms['frmTask'].TabSelected.value;                    
  334.         
  335.             switch(temp)
  336.             {
  337.                 //for general prop
  338.                 case '0':                        
  339.                     return GenValidatePage();
  340.                     break;
  341.                 //for Site prop    
  342.                 case '1':
  343.                     return SiteValidatePage();
  344.                     break;
  345.                 //for Appl prop    
  346.                 case '2':
  347.                     return ApplValidatePage();
  348.                     break;    
  349.             }
  350.         }
  351.                 
  352.         // SetData Function
  353.         // --------------
  354.         // This function is called by the Property Page framework and is called
  355.         // only if ValidatePage returned a success (true) code. Typically you 
  356.         // would modify hidden form fields at this point. 
  357.         //
  358.         // This function must be included or a javascript runtime error will 
  359.         // occur.
  360.         function SetData()
  361.         {        
  362.  
  363.             //Get the selected tab
  364.             var temp = top.main.document.forms['frmTask'].TabSelected.value;                    
  365.             
  366.             switch(temp)
  367.             {
  368.                 //for general prop
  369.                 case '0':
  370.                     GenSetData();
  371.                     break;
  372.                 //for Site prop    
  373.                 case '1':
  374.                     SiteSetData();
  375.                     break;
  376.                 //for Appl prop
  377.                 case '2':
  378.                     ApplSetData();
  379.                     break;    
  380.             }
  381.         }
  382.         </script>
  383.     <%
  384.     End Function
  385.  
  386.     '----------------------------------------------------------------------------
  387.     'Function name        :ModifySite
  388.     'Description        :Serves in Modifying the Site
  389.     'Input Variables    :None 
  390.     'Output Variables    :None
  391.     'Returns            :Boolean (True if new site is created else returns False)
  392.     'Global Variables    :None
  393.     'Functions Used        :ModifySite
  394.     '----------------------------------------------------------------------------
  395.     Function ModifySite()
  396.         on error resume next 
  397.         Err.Clear
  398.  
  399.         ModifySite = False
  400.         '1)Modify Web site
  401.          if NOT blnModifyWebSite() then
  402.             Exit Function
  403.          End if
  404.  
  405.         '2) config virtual FTP site
  406.         Dim objService
  407.         Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  408.         If F_strUploadMethod = UPLOADMETHOD_FTP Then
  409.             If NOT IsUserVirFTPInstalled(objService, F_strAdminName) Then 
  410.                 If NOT CreateVirFTPSite(objService, F_strAdminName, F_strDir, _
  411.                         True, True, True) Then
  412.                     SetErrMsg L_ERR_CREATE_VIR_FTP_SITE
  413.                     Exit Function
  414.                 End If
  415.             End If
  416.         Else
  417.             If IsUserVirFTPInstalled(objService, F_strAdminName) Then
  418.                 If NOT DeleteVirFTPSite(objService, F_strAdminName) Then
  419.                     SetErrMsg L_ERR_DELETE_VIR_FTP_SITE
  420.                     Exit Function
  421.                 End If
  422.             End If
  423.         End If
  424.         
  425.         ModifySite = True        
  426.         Set objService = Nothing
  427.     end function
  428.  
  429.     '----------------------------------------------------------------------------
  430.     'Function name        :blnModifyWebSite
  431.     'Description        :Modifying the web site
  432.     'Input Variables    :None 
  433.     'Output Variables    :None
  434.     'Returns            :Boolean (True if site is modified else returns False)
  435.     'Global Variables    :G_strDirRoot, G_strSysName
  436.     '----------------------------------------------------------------------------
  437.     Function blnModifyWebSite()
  438.         Err.Clear
  439.         On Error Resume Next
  440.  
  441.         Dim objService            ' To hold WMI connection object
  442.         Dim arrBindings            ' To hold Full IP address as array
  443.         Dim strUserName            ' To hold Admin user name
  444.         Dim strAnonName            ' To hold Anon user name
  445.         Dim retVal
  446.         Dim bIISControlPswd
  447.  
  448.         blnModifyWebSite = FALSE
  449.  
  450.         G_strSiteNum = GetWebSiteNo(F_strSiteID)
  451.         Call GetDomainRole( G_strDirRoot, G_strSysName )
  452.  
  453.         'get the wmi iis service object
  454.         set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  455.         objService.security_.impersonationlevel = 3
  456.  
  457.         '1) modify user passwd
  458.         if F_strPswdChanged = 1 then
  459.             if SetUserPassword(objService, F_strAdminName, F_strAdminPswd) = FALSE then
  460.                 SA_TraceOut "site_modify", "modify user passwd failed"
  461.                 exit function
  462.             end if
  463.         end if
  464.  
  465.         '2) moidify web bindings
  466.         arrBindings = Array(GetBindings(F_strIPAddr, trim(F_strPort), F_strHeader))    
  467.         if SetServerBindings( objService, G_strSiteNum, arrBindings ) = FALSE then
  468.             SA_TraceOut "site_modify", "set Server bindings failed"
  469.             exit function
  470.         end if
  471.  
  472.         '3)set Allow Anonymous property
  473.         If F_strUserLocation = "1" Then
  474.             'Get anon user
  475.             If isValidUser(F_strSiteID&"_Anon",G_strSysName) Then
  476.                 strAnonName = G_AnonUserName
  477.             Else
  478.                 strAnonName = F_strSiteID&"_Anon"
  479.             End If
  480.             if SetAnonProp(objService, G_strSiteNum, F_strchkAllow, strAnonName, "", True) = FALSE then
  481.                 SA_TraceOut "site_modify", "set anonymous prop failed"
  482.                 exit function
  483.             end if
  484.         Else 'F_strUserLocation = "0" or "2"
  485.             If isValidUser(F_strSiteID&"_Anon",G_strDirRoot) Then
  486.                 strAnonName = G_AnonUserName
  487.                 bIISControlPswd = True
  488.             Else
  489.                 strAnonName = G_strDirRoot&"\"&F_strSiteID&"_Anon"
  490.                 bIISControlPswd =False
  491.             End If
  492.             if SetAnonProp(objService, G_strSiteNum, F_strchkAllow, strAnonName, "", bIISControlPswd) = FALSE then
  493.                 SA_TraceOut "site_modify", "set anonymous prop failed"
  494.                 exit function
  495.             end if
  496.         End If
  497.  
  498.         '4) set execute permissions
  499.         if F_selectActiveFormat = "" then            
  500.             Dim objSetting         
  501.             Set objSetting =objService.Get(GetIISWMIProviderClassName("IIs_WebServiceSetting") & ".Name='W3SVC'")
  502.             if objSetting.Name = "W3SVC" then    
  503.                 if objSetting.AccessExecute = TRUE and objSetting.AccessScript = TRUE then
  504.                     F_selectActiveFormat = 2
  505.                 elseif objSetting.AccessExecute = false and objSetting.AccessScript = TRUE then
  506.                     F_selectActiveFormat = 1
  507.                 elseif objSetting.AccessExecute = false and objSetting.AccessScript = false then
  508.                     F_selectActiveFormat =0
  509.                 elseif isnull(objSetting.AccessExecute) and isnull(objSetting.AccessScript) then
  510.                     F_selectActiveFormat = 0
  511.                 end if
  512.             end    if
  513.             set objSetting = nothing                
  514.         end if
  515.         if NOT SetExecPerms(F_selectActiveFormat, objService, G_strSiteNum) then
  516.             SA_TraceOut "site_modify", "set execute permissions failed"
  517.             exit function
  518.         end if
  519.  
  520.         '5) try to start the web site
  521.         if StartWebSite(objService, G_strSiteNum ) = FALSE then
  522.             SA_TraceOut "site_modify", "Failed to start the Web site"
  523.         end if
  524.  
  525.         '6) Update front page extensions
  526.         retVal = IsFrontPageInstalledOnWebSite(G_strSysName, G_strSiteNum)
  527.         Call GetWebAdministrtorRole(objService, G_strSiteNum, strUserName)
  528.         If ((F_strUploadMethod = UPLOADMETHOD_FPSE) and (NOT retVal)) Then
  529.             If UpdateFrontPage("true", G_strSiteNum, strUserName) = FALSE Then
  530.                 SA_TraceOut "site_modify", "Failed to update frontpage"
  531.                 SetErrMsg L_ERR_FRONTPAGE_CONFIGURATION
  532.                 exit function
  533.             end if
  534.         ElseIf ((F_strUploadMethod <> UPLOADMETHOD_FPSE) and retVal) Then
  535.             If UpdateFrontPage("false", G_strSiteNum, strUserName) = FALSE Then
  536.                 SA_TraceOut "site_modify", "Failed to update frontpage"
  537.                 SetErrMsg L_ERR_FRONTPAGE_CONFIGURATION
  538.                 exit function
  539.             end if
  540.         End If
  541.  
  542.         '7) set default web page
  543.         Call SetWebDefaultPage(objService,F_strDefaultPageText,G_strSiteNum)
  544.  
  545.         'release objects
  546.         set objService = nothing
  547.  
  548.         Call SA_MungeURL(mstrReturnURL, "PKey",G_strSiteNum)
  549.         blnModifyWebSite = true
  550.     End function
  551.  
  552.     '-------------------------------------------------------------------------
  553.     'Function name        :SetFormVarsFromSystem
  554.     'Description        :updates the frontpage extensions
  555.     'Input Variables    :strSiteName
  556.     'Output Variables    :None
  557.     'Returns            :Boolean
  558.     'Global Variables    :None
  559.     '-------------------------------------------------------------------------
  560.     Function SetFormVarsFromSystem()
  561.         On Error Resume Next
  562.         Err.Clear
  563.  
  564.         Const CONST_PWD = "********"
  565.  
  566.         Dim objService        
  567.         Dim strRoot        
  568.         Dim strObjPath
  569.         Dim objVirDir
  570.         Dim ObjIPCollection        ' To hold IP collection object
  571.         Dim instIPAddr            ' To hold IP collection instance
  572.         Dim IPCount                ' To hold IP count
  573.         Dim strIPArr, ObjSiteCollection
  574.         Dim strIPAddr,strQuery, arrIndx
  575.         Dim AdminName                ' To hold Admin user name
  576.         Dim blnAdminUser            ' To hold boolean value for Admin user
  577.         Dim VirDirSetInst    ' To hold Virtual Dir setting object
  578.         Dim arrID
  579.         Dim retVal
  580.         Dim strAdminRole
  581.  
  582.  
  583.         Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)                
  584.         objService.security_.impersonationlevel = 3        
  585.  
  586.         '1) init the general tab vars
  587.         strAdminRole = GetWebAdministrtorRole(objService, G_strSiteNum, AdminName)
  588.  
  589.         arrID = split(AdminName,"\")
  590.         F_strAdminName = arrID(1)
  591.  
  592.         strRoot = G_strSiteNum & "/ROOT"
  593.  
  594.         strObjPath = GetIISWMIProviderClassName("IIs_WebVirtualDirSetting") & ".Name=" & chr(34) & strRoot & chr(34)
  595.  
  596.         set objVirDir = objService.Get(strObjPath)
  597.  
  598.         If Err.number <> 0 Then
  599.             SA_ServeFailurePage L_INFORMATION_ERRORMESSAGE
  600.             exit function
  601.         End if        
  602.  
  603.         F_strDir = objVirDir.Path
  604.         F_strAdminPswd = CONST_PWD
  605.         F_strConfirmPswd = CONST_PWD
  606.         F_strPswdChanged = 0
  607.         set objVirDir  = nothing 
  608.  
  609.         F_strSiteID = GetWebSiteName(G_strSiteNum)
  610.  
  611.         If strAdminRole = "Domain User" Then
  612.             F_strUserLocation = "0"
  613.         Elseif strAdminRole = "Local User" Then
  614.             F_strUserLocation = "1"
  615.         End If
  616.  
  617.         '2) init the identifier tab vars
  618.         strObjPath = GetIISWMIProviderClassName("IIs_WebServerSetting") & ".Name='"& G_strSiteNum & "'"    
  619.  
  620.         set objSiteCollection = objService.Get(strObjPath)
  621.  
  622.         If Err.number <> 0 Then
  623.             SA_ServeFailurePage L_INFORMATION_ERRORMESSAGE
  624.             exit function
  625.         End if
  626.         
  627.         'Getting the Site Description , IP Address and Port for site        
  628.         
  629.         if IsIIS60Installed Then
  630.         
  631.             F_strPort = objSiteCollection.ServerBindings(0).Port
  632.             F_strIPAddr = objSiteCollection.ServerBindings(0).IP
  633.             F_strHeader    = objSiteCollection.ServerBindings(0).Hostname
  634.         
  635.         Else
  636.         
  637.             strIPArr=split(objSiteCollection.ServerBindings(0),":")
  638.             if strIPArr(0)="" then
  639.                 strIPAddr= "All Unassigned"
  640.             else
  641.                 F_strIPAddr = strIPArr(0)
  642.             end if
  643.             if strIPArr(1) = "" then
  644.                 F_strPort = 80
  645.             else            
  646.                 F_strPort=strIPArr(1)
  647.             end if
  648.  
  649.             if ubound(strIPArr) > 2 then             
  650.                 for arrIndx = 2 to ubound(strIPArr) 
  651.                     F_strHeader = F_strHeader & strIPArr(arrIndx) & ":"
  652.                 next
  653.                 F_strHeader = left(F_strHeader,len(F_strHeader)-1)
  654.             else
  655.                 F_strHeader = strIPArr(2)
  656.             end if
  657.             set objSiteCollection = nothing 
  658.  
  659.         End If ' If IsIIS60Installed 
  660.  
  661.  
  662.  
  663.         '3) init application settings tab vars
  664.  
  665.         strQuery = GetIISWMIProviderClassName("IIs_WebVirtualDirSetting") & ".Name='" & G_strSiteNum & "/ROOT'"
  666.  
  667.         set VirDirSetInst = objService.get(strQuery)
  668.         If Err.number <> 0 Then
  669.             SA_ServeFailurepage L_INFORMATION_ERRORMESSAGE 
  670.             exit function
  671.         End if
  672.  
  673.         if VirDirSetInst.AccessExecute = TRUE and VirDirSetInst.AccessScript = TRUE then
  674.             F_selectActiveFormat = 2
  675.         elseif VirDirSetInst.AccessExecute = false and VirDirSetInst.AccessScript = TRUE then
  676.             F_selectActiveFormat = 1
  677.         elseif VirDirSetInst.AccessExecute = false and VirDirSetInst.AccessScript = false then
  678.             F_selectActiveFormat =0
  679.         elseif isnull(VirDirSetInst.AccessExecute) and isnull(VirDirSetInst.AccessScript) then
  680.             F_selectActiveFormat = 0
  681.         end if
  682.  
  683.         retVal = VirDirSetInst.AuthAnonymous
  684.         
  685.         If retVal Then
  686.             F_strchkAllow = "true"
  687.         Else
  688.             F_strchkAllow = "false"
  689.         End If
  690.  
  691.         F_strDefaultPageText = VirDirSetInst.DefaultDoc
  692.  
  693.         If Err.number <> 0 Then
  694.             SetErrMsg L_INFORMATION_ERRORMESSAGE
  695.             exit function
  696.         End if
  697.  
  698.  
  699.         '
  700.         ' Determine the current upload method.  If both FPSE and FTP are
  701.         ' enabled (which would have had to happen outside our UI), FPSE will
  702.         ' be selected.
  703.         '
  704.         F_strUploadMethod = UPLOADMETHOD_NEITHER
  705.         
  706.         ' Determine whether FrontPage Extensions are installed
  707.         If (isFrontPageInstalled(objService)) Then
  708.             Call GetDomainRole(G_strDirRoot, G_strSysName)
  709.             If (IsFrontPageInstalledOnWebSite(G_strSysName, G_strSiteNum)) Then
  710.                 F_strUploadMethod = UPLOADMETHOD_FPSE
  711.             End If 
  712.         End If
  713.         
  714.         ' If FrontPage Extensions weren't installed, check FTP.
  715.         If ((F_strUploadMethod <> UPLOADMETHOD_FPSE) And _
  716.             IsUserVirFTPInstalled(objService, F_strAdminName)) Then
  717.             
  718.                F_strUploadMethod = UPLOADMETHOD_FTP
  719.         End If
  720.     End Function
  721.  
  722.     '----------------------------------------------------------------------------
  723.     'Function name        :SetUserPassword
  724.     'Description        :Serves in to set password
  725.     'Input Variables    :UserName,Password
  726.     'Output Variables    :None
  727.     'Returns            :Boolean 
  728.     'Global Variables    :G_strDirRoot, G_strSysName
  729.     '----------------------------------------------------------------------------
  730.  
  731.     Function SetUserPassword(objService, UserName, Password)
  732.         On Error Resume Next
  733.         Err.Clear
  734.  
  735.         Dim objUser            ' To hold user object
  736.         Dim objComputer        ' To hold computer object
  737.         Dim strAdminName
  738.         Dim strDomain
  739.         Dim arrID
  740.         Dim retval
  741.  
  742.         SetUserPassword = FALSE
  743.         G_strSiteNum = GetWebSiteNo(F_strSiteID)
  744.         Call GetDomainRole( G_strDirRoot, G_strSysName )
  745.  
  746.         retval = GetWebAdministrtorRole(objService, G_strSiteNum, strAdminName)
  747.         arrID = split(strAdminName,"\")
  748.         strDomain = arrID(0)
  749.  
  750.         If ucase(strDomain) = ucase(G_strSysName) Then
  751.             Set objComputer = GetObject("WinNT://" & strDomain)
  752.             If Err.number <> 0 Then
  753.                 SetErrMsg SA_GetLocString("Sitearea.dll", "C04201D4", _
  754.                                     Array("WinNT://" & strDomain))
  755.                 Exit Function
  756.             End if
  757.  
  758.             Set objUser = objComputer.GetObject("User" , UserName)
  759.             if Err.number <> 0 Then                    
  760.                 if Err.number = CONST_USER_NOTFOUND_ERRMSG Then
  761.                     'user does not exist, create the user
  762.                     Set objUser = Nothing
  763.                     Set objUser = objComputer.Create("user" , trim(UserName))
  764.                 else            
  765.                     setErrmsg L_ERR_GET_USER_OBJECT
  766.                     exit Function
  767.                 end if
  768.             end if
  769.  
  770.             objUser.setPassword(trim(Password))
  771.             objUser.FullName    = UserName
  772.             objUser.SetInfo()
  773.             If Err.number <> 0 Then    
  774.                 'The password does not meet the password policy requirrments
  775.                 mintTabSelected = 0    
  776.                 If Err.number = &H800708C5 Then
  777.                     SetErrMsg L_ERR_PASSWORD_POLICY
  778.                 Else
  779.                     SetErrMsg L_UNABLETOSET_PASSWORD_ERRORMESSAGE
  780.                 End If
  781.                 exit Function
  782.             end if
  783.             'Release the object
  784.             set objUser = nothing
  785.             set objComputer = nothing
  786.         Else
  787.             If Instr(UserName,"_Admin") <> 0 Then
  788.                 SA_TraceOut "site_modify.asp", "calling ModifyUserInOu"
  789.                 'create the OU with site identifier and create Admin user in that OU
  790.                 if ModifyUserInOu(F_strSiteID,strDomain,UserName, Password, F_strSiteID & "_Admins") = false then
  791.                     exit function
  792.                 end if
  793.             End If
  794.         End If
  795.  
  796.         SetUserPassword = TRUE
  797.         Call SA_TRACEOUT("SetUserPassword","return success")
  798.     End Function
  799.  
  800. %>
  801.